package org.altervista.cp.thinjdbc.wrappers;

import java.sql.SQLException;

public abstract class DatabaseMetaData extends
		Wrapper<java.sql.DatabaseMetaData> implements java.sql.DatabaseMetaData {

	static final DatabaseMetaData newInstance(java.sql.DatabaseMetaData dbmd) {
		return _GENERATOR.generate(dbmd);
	}

	public ResultSet getAttributes(String catalog, String schemaPattern,
			String typeNamePattern, String attributeNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getAttributes(catalog,
					schemaPattern, typeNamePattern, attributeNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getBestRowIdentifier(String catalog, String schema,
			String table, int scope, boolean nullable) {
		try {
			return ResultSet.newInstance(unwrap().getBestRowIdentifier(
					catalog, schema, table, scope, nullable));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getCatalogs() {
		try {
			return ResultSet.newInstance(unwrap().getCatalogs());
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getColumnPrivileges(String catalog, String schema,
			String table, String columnNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getColumnPrivileges(
					catalog, schema, table, columnNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getColumns(String catalog, String schemaPattern,
			String tableNamePattern, String columnNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getColumns(catalog,
					schemaPattern, tableNamePattern, columnNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public Connection getConnection() {
		return _cw;
	}

	public ResultSet getCrossReference(String parentCatalog,
			String parentSchema, String parentTable, String foreignCatalog,
			String foreignSchema, String foreignTable) {
		try {
			return ResultSet.newInstance(unwrap().getCrossReference(
					parentCatalog, parentSchema, parentTable, foreignCatalog,
					foreignSchema, foreignTable));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getExportedKeys(String catalog, String schema,
			String table) {
		try {
			return ResultSet.newInstance(unwrap().getExportedKeys(
					catalog, schema, table));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getImportedKeys(String catalog, String schema,
			String table) {
		try {
			return ResultSet.newInstance(unwrap().getImportedKeys(
					catalog, schema, table));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getIndexInfo(String catalog, String schema,
			String table, boolean unique, boolean approximate) {
		try {
			return ResultSet.newInstance(unwrap().getIndexInfo(catalog,
					schema, table, unique, approximate));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getPrimaryKeys(String catalog, String schema,
			String table) {
		try {
			return ResultSet.newInstance(unwrap().getPrimaryKeys(
					catalog, schema, table));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getProcedureColumns(String catalog,
			String schemaPattern, String procedureNamePattern,
			String columnNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getProcedureColumns(
					catalog, schemaPattern, procedureNamePattern,
					columnNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getProcedures(String catalog, String schemaPattern,
			String procedureNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getProcedures(catalog,
					schemaPattern, procedureNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getSchemas() {
		try {
			return ResultSet.newInstance(unwrap().getSchemas());
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getSuperTables(String catalog,
			String schemaPattern, String tableNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getSuperTables(
					catalog, schemaPattern, tableNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getSuperTypes(String catalog, String schemaPattern,
			String typeNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getSuperTypes(catalog,
					schemaPattern, typeNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getTablePrivileges(String catalog,
			String schemaPattern, String tableNamePattern) {
		try {
			return ResultSet.newInstance(unwrap().getTablePrivileges(
					catalog, schemaPattern, tableNamePattern));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getTables(String catalog, String schemaPattern,
			String tableNamePattern, String[] types) {
		try {
			return ResultSet.newInstance(unwrap().getTables(catalog,
					schemaPattern, tableNamePattern, types));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getTableTypes() {
		try {
			return ResultSet.newInstance(unwrap().getTableTypes());
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getVersionColumns(String catalog, String schema,
			String table) {
		try {
			return ResultSet.newInstance(unwrap().getVersionColumns(
					catalog, schema, table));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getTypeInfo() {
		try {
			return ResultSet.newInstance(unwrap().getTypeInfo());
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public ResultSet getUDTs(String catalog, String schemaPattern,
			String typeNamePattern, int[] types) {
		try {
			return ResultSet.newInstance(unwrap().getUDTs(catalog,
					schemaPattern, typeNamePattern, types));
		} catch (SQLException e) {
			throw new SQLRuntimeException(e);
		}
	}

	public abstract boolean allProceduresAreCallable();

	public abstract boolean allTablesAreSelectable();

	public abstract boolean autoCommitFailureClosesAllResultSets();

	public abstract boolean dataDefinitionCausesTransactionCommit();

	public abstract boolean dataDefinitionIgnoredInTransactions();

	public abstract boolean deletesAreDetected(int type);

	public abstract boolean doesMaxRowSizeIncludeBlobs();

	public abstract String getCatalogSeparator();

	public abstract String getCatalogTerm();

	public abstract int getDatabaseMajorVersion();

	public abstract int getDatabaseMinorVersion();

	public abstract String getDatabaseProductName();

	public abstract String getDatabaseProductVersion();

	public abstract int getDefaultTransactionIsolation();

	public abstract int getDriverMajorVersion();

	public abstract int getDriverMinorVersion();

	public abstract String getDriverName();

	public abstract String getDriverVersion();

	public abstract String getExtraNameCharacters();

	public abstract String getIdentifierQuoteString();

	public abstract int getJDBCMajorVersion();

	public abstract int getJDBCMinorVersion();

	public abstract int getMaxBinaryLiteralLength();

	public abstract int getMaxCatalogNameLength();

	public abstract int getMaxCharLiteralLength();

	public abstract int getMaxColumnNameLength();

	public abstract int getMaxColumnsInGroupBy();

	public abstract int getMaxColumnsInIndex();

	public abstract int getMaxColumnsInOrderBy();

	public abstract int getMaxColumnsInSelect();

	public abstract int getMaxColumnsInTable();

	public abstract int getMaxConnections();

	public abstract int getMaxCursorNameLength();

	public abstract int getMaxIndexLength();

	public abstract int getMaxProcedureNameLength();

	public abstract int getMaxRowSize();

	public abstract int getMaxSchemaNameLength();

	public abstract int getMaxStatementLength();

	public abstract int getMaxStatements();

	public abstract int getMaxTableNameLength();

	public abstract int getMaxTablesInSelect();

	public abstract int getMaxUserNameLength();

	public abstract String getNumericFunctions();

	public abstract String getProcedureTerm();

	public abstract int getResultSetHoldability();

	public abstract String getSQLKeywords();

	public abstract int getSQLStateType();

	public abstract String getSchemaTerm();

	public abstract String getSearchStringEscape();

	public abstract String getStringFunctions();

	public abstract String getSystemFunctions();

	public abstract String getTimeDateFunctions();

	public abstract String getURL();

	public abstract String getUserName();

	public abstract boolean insertsAreDetected(int type);

	public abstract boolean isCatalogAtStart();

	public abstract boolean isReadOnly();

	public abstract boolean locatorsUpdateCopy();

	public abstract boolean nullPlusNonNullIsNull();

	public abstract boolean nullsAreSortedAtEnd();

	public abstract boolean nullsAreSortedAtStart();

	public abstract boolean nullsAreSortedHigh();

	public abstract boolean nullsAreSortedLow();

	public abstract boolean othersDeletesAreVisible(int type);

	public abstract boolean othersInsertsAreVisible(int type);

	public abstract boolean othersUpdatesAreVisible(int type);

	public abstract boolean ownDeletesAreVisible(int type);

	public abstract boolean ownInsertsAreVisible(int type);

	public abstract boolean ownUpdatesAreVisible(int type);

	public abstract boolean storesLowerCaseIdentifiers();

	public abstract boolean storesLowerCaseQuotedIdentifiers();

	public abstract boolean storesMixedCaseIdentifiers();

	public abstract boolean storesMixedCaseQuotedIdentifiers();

	public abstract boolean storesUpperCaseIdentifiers();

	public abstract boolean storesUpperCaseQuotedIdentifiers();

	public abstract boolean supportsANSI92EntryLevelSQL();

	public abstract boolean supportsANSI92FullSQL();

	public abstract boolean supportsANSI92IntermediateSQL();

	public abstract boolean supportsAlterTableWithAddColumn();

	public abstract boolean supportsAlterTableWithDropColumn();

	public abstract boolean supportsBatchUpdates();

	public abstract boolean supportsCatalogsInDataManipulation();

	public abstract boolean supportsCatalogsInIndexDefinitions();

	public abstract boolean supportsCatalogsInPrivilegeDefinitions();

	public abstract boolean supportsCatalogsInProcedureCalls();

	public abstract boolean supportsCatalogsInTableDefinitions();

	public abstract boolean supportsColumnAliasing();

	public abstract boolean supportsConvert();

	public abstract boolean supportsConvert(int fromType, int toType);

	public abstract boolean supportsCoreSQLGrammar();

	public abstract boolean supportsCorrelatedSubqueries();

	public abstract boolean supportsDataDefinitionAndDataManipulationTransactions();

	public abstract boolean supportsDataManipulationTransactionsOnly();

	public abstract boolean supportsDifferentTableCorrelationNames();

	public abstract boolean supportsExpressionsInOrderBy();

	public abstract boolean supportsExtendedSQLGrammar();

	public abstract boolean supportsFullOuterJoins();

	public abstract boolean supportsGetGeneratedKeys();

	public abstract boolean supportsGroupBy();

	public abstract boolean supportsGroupByBeyondSelect();

	public abstract boolean supportsGroupByUnrelated();

	public abstract boolean supportsIntegrityEnhancementFacility();

	public abstract boolean supportsLikeEscapeClause();

	public abstract boolean supportsLimitedOuterJoins();

	public abstract boolean supportsMinimumSQLGrammar();

	public abstract boolean supportsMixedCaseIdentifiers();

	public abstract boolean supportsMixedCaseQuotedIdentifiers();

	public abstract boolean supportsMultipleOpenResults();

	public abstract boolean supportsMultipleResultSets();

	public abstract boolean supportsMultipleTransactions();

	public abstract boolean supportsNamedParameters();

	public abstract boolean supportsNonNullableColumns();

	public abstract boolean supportsOpenCursorsAcrossCommit();

	public abstract boolean supportsOpenCursorsAcrossRollback();

	public abstract boolean supportsOpenStatementsAcrossCommit();

	public abstract boolean supportsOpenStatementsAcrossRollback();

	public abstract boolean supportsOrderByUnrelated();

	public abstract boolean supportsOuterJoins();

	public abstract boolean supportsPositionedDelete();

	public abstract boolean supportsPositionedUpdate();

	public abstract boolean supportsResultSetConcurrency(int type,
			int concurrency);

	public abstract boolean supportsResultSetHoldability(int holdability);

	public abstract boolean supportsResultSetType(int type);

	public abstract boolean supportsSavepoints();

	public abstract boolean supportsSchemasInDataManipulation();

	public abstract boolean supportsSchemasInIndexDefinitions();

	public abstract boolean supportsSchemasInPrivilegeDefinitions();

	public abstract boolean supportsSchemasInProcedureCalls();

	public abstract boolean supportsSchemasInTableDefinitions();

	public abstract boolean supportsSelectForUpdate();

	public abstract boolean supportsStatementPooling();

	public abstract boolean supportsStoredFunctionsUsingCallSyntax();

	public abstract boolean supportsStoredProcedures();

	public abstract boolean supportsSubqueriesInComparisons();

	public abstract boolean supportsSubqueriesInExists();

	public abstract boolean supportsSubqueriesInIns();

	public abstract boolean supportsSubqueriesInQuantifieds();

	public abstract boolean supportsTableCorrelationNames();

	public abstract boolean supportsTransactionIsolationLevel(int level);

	public abstract boolean supportsTransactions();

	public abstract boolean supportsUnion();

	public abstract boolean supportsUnionAll();

	public abstract boolean updatesAreDetected(int type);

	public abstract boolean usesLocalFilePerTable();

	public abstract boolean usesLocalFiles();

	void close() {
		_cw = null;

		_GENERATOR.release(this);
	}

	void setConnectionWrapper(Connection cw) {
		_cw = cw;
	}

	private Connection _cw;

	private static final _ProxyGenerator<DatabaseMetaData> _GENERATOR = new _ProxyGenerator<DatabaseMetaData>(
			DatabaseMetaData.class);

}
